package cn.edu.ctbu.tydemo.controller;


import cn.edu.ctbu.tydemo.domain.Teacher;
import cn.edu.ctbu.tydemo.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class TeacherController {

    @Autowired
    TeacherService teacherService;

    @RequestMapping("/teacher/list")
    public String list(Model model){

        List<Teacher> teachers=teacherService.findAll();
        model.addAttribute("data",teachers);
        return "teacher/list";

    }
}
